import java.util.Hashtable;

class P444 {

	private static Hashtable dic;

	static void generateDictionary() {
		dic = new Hashtable();
		for (int k = 'a'; k <= 'z'; k++) {
			String reverse = reverse(k);
			dic.put(reverse, ((char)k)+"");
		}
		
		for (int k = 'A'; k <= 'Z'; k++) {
			String reverse = reverse(k);
			dic.put(reverse, ((char)k)+"");
		}

		String reverse = reverse(' ');
		dic.put(reverse, (' ')+"");

		reverse = reverse('!');
		dic.put(reverse, ((char)'!')+"");

		reverse = reverse(',');
		dic.put(reverse, ((char)',')+"");

		reverse = reverse('.');
		dic.put(reverse, ((char)'.')+"");

		reverse = reverse(':');
		dic.put(reverse, ((char)':')+"");

		reverse = reverse(';');
		dic.put(reverse, ((char)';')+"");

		reverse = reverse('?');
		dic.put(reverse, ((char)'?')+"");
		
//		System.out.println(dic);
		
	}
	
	public static void main(String[] args) {
		generateDictionary();
		try {
		String line = readLn();
		while (line != null) {
			process(line);
			line = readLn();
		} } catch (Exception e) {
			while (true) {
				
			}
		}
	}

	private static void process(String line) {
		if (hasOnlyNumbers(line)) {
			decode(line);
		} else {
			encode(line);
		}
	}

	private static void encode(String line) {
		String answer = "";
		for (int k = 0; k < line.length(); k++) {
			int ascii = line.charAt(k);
			answer = reverse(ascii) + answer;
		}
		System.out.println(answer);
	}

	private static String reverse(int ascii) {
		String aux = ascii + "";
		String answer = "";
		for (int k = 0; k < aux.length(); k++) {
			answer = aux.charAt(k) + answer;
		}
		return answer;
	}

	
	
	private static void decode(String line) {
		String answer = "";
		int term = line.length();
		for (int k = line.length() - 1 ; k >= 0; k--) {
			String x = (String) dic.get(line.substring(k, term)); 
			if (x != null) {
				answer += x;
				term = k ;
			}
		}
		System.out.println(answer);
	}

	private static boolean hasOnlyNumbers(String line) {
		for (int k = 0; k < line.length(); k++) {
			char c = line.charAt(k);
			if ( 'a' <= c && 'z' >= c || 'A' <= c && 'Z' >= c) {
				return false;
			}
		}
		return true;
	}

	static String readLn() {
		String newLine = System.getProperty("line.separator");
		StringBuffer buffer = new StringBuffer();
		int car = -1;
		try {
			car = System.in.read();
			while ((car > 0) && (car != newLine.charAt(0))) {
				buffer.append((char) car);
				car = System.in.read();
			}
			if (car == newLine.charAt(0))
				System.in.skip(newLine.length() - 1);
		} catch (java.io.IOException e) {
			return (null);
		}
		if ((car < 0) && (buffer.length() == 0))
			return (null);
		return (buffer.toString()).trim();
	}

}